import React, { Component } from 'react'
//路由传参
import {withRouter} from "react-router-dom"
import {Bottom} from "antd-mobile"
import "./index.scss"
import ReSet from '../../assets/img/my-reset.png'
import Lw from '../../assets/img/my-lw.png'
import requestAxios from '../../utils/myaxios'
import Nv from '../../assets/img/my_nv.png'
class Index extends Component {
    
    state = {
        rightStart:">",
        userInfoIns:{}
    }

    componentDidMount(){
        document.title="个人中心"
        const userInfo = localStorage.getItem("userInfoIns")
        const userInfoIns = JSON.parse(userInfo) || {}
        this.setState({
            userInfoIns:userInfoIns
        })
    
        console.log(userInfoIns.headerImg)
    }


    handleClick = (params) => {
        this.props.history.push("/searchCenter");
    }

    wsOnClick = ()=>{
        console.log("完善信息")
        this.props.history.push("/myinformation")
    }

    jfOnClick = ()=>{
        console.log("积分")
        this.props.history.push("/orderinformation")
    }

    kfOnClick = ()=>{
        console.log("客服...")
        this.props.history.push("/contactus")
    }

    lwOnClick = ()=>{
        console.log("礼物...")
        this.props.history.push("/integral")
    }
    
    render() {
        const {rightStart,userInfoIns} = this.state
        return (
            <div className="my-main-app">
                {/* 头部 */}
                <header className="my-header">
                    {/* 个人中心 */}
                    <h3>个人中心</h3>
                    {/* 头像 */}
                    <section className="my-header-img">
                        <img src={userInfoIns.headerImg?userInfoIns.headerImg:Nv}></img>
                    </section>
                    {/* 昵称 ,修改昵称*/}
                    <section className="my-header-username">
                        <span>{userInfoIns.userName}</span>
                        <img src={ReSet}></img>
                    </section>
                </header>

                {/* 内容部分 */}
                <main className="my-main-con">
                    <div className="my-main-con-information" onClick={this.wsOnClick}>
                        <h4>完善信息</h4>
                        <h1>{rightStart}</h1>
                    </div>    
                    <div className="my-main-con-information" onClick={this.jfOnClick}>
                        <h4>积分</h4>
                        <h1>{rightStart}</h1>
                    </div> 
                    <div className="my-main-con-information" onClick={this.kfOnClick}>
                        <h4>联系客服</h4>
                        <h1>{rightStart}</h1>
                    </div> 

                      {/* 底部小图标 */}
                    {/* <footer className="my-main-icon" onClick={this.lwOnClick}>
                        <img src="https://img0.baidu.com/it/u=285365348,2122345438&fm=26&fmt=auto&gp=0.jpg"></img>
                    </footer> */}
                </main>

              
            </div>
        )
    }
}
export default withRouter(Index)
